package com.qf.controller;

import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
import com.google.gson.JsonObject;
import com.qf.service.ShibieService;
import com.qf.utils.AuthService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.multipart.MultipartFile;

import java.util.HashMap;
import java.util.Map;

@RestController
public class ShibieController {
    @Autowired
    ShibieService shibieService;
    @RequestMapping("/testUser")
    public String test(@RequestBody Map map){
        String image = (String) map.get("image");
        String substring = image.substring(22);
        String auth = AuthService.getAuth();

        String username="cyl";
        String s = shibieService.faceSearch(substring, auth,username);
        Map res = JSONObject.parseObject(s, Map.class);
        res.get("result");
        return s;
    }
}
